// axios二次封装
import axios from 'axios'
// create an axios instance
const fetch = axios.create({
  baseURL: process.env.NODE_ENV === 'development' ? 'http://localhost:8088' : 'http://wct.lihexinzhiye.com',
  //上线用这个
  // baseURL:  'http://zyjkjava.lihexinzhiye.com',
  // baseURL:  'http://wct.lihexinzhiye.com',
  //内网穿透测试
  // baseURL:  'http://sr3uqj.natappfree.cc',
  timeout: 50000
})
// request请求拦截器
fetch.interceptors.request.use(
  config => {
    const token = localStorage.getItem('token')
    token && (config.headers.token = token)
    return config
  }, error => {
    Promise.reject(error)
  })

axios.defaults.withCredentials = true
export default fetch


//访问启效云获取班级信息
export function classesGet(openID){
  return fetch ({
    url:'/recommend/classesGet?openID=' + openID,
    method:'post',
  })
}

//访问启效云获取学员信息
export function stuSalesGet(openID,classID){
  return fetch ({
    url:'/recommend/stuSalesGet?openID=' + openID + '&classID=' + classID,
    method:'post',
  })
}
